<template>
    <view class="p_10">
        <rich-text :nodes="richText"  space="ensp" catchtap="catchImage"> </rich-text>
    </view>
</template>
<script>
import {getByKeyApi} from "@/sheep/api";

export default {
    name: "index",
    data() {
        return {
            richText:'',
            keyName:''
        }
    },
    onLoad(params) {
        //type 1:免责协议 2:用户协议  3:隐私协议 4:关于我们
        this.type = params.type
        let title = '协议'
        if (this.type==1){
            this.keyName = 'disclaimerRules'
            title='免责协议'
        }else if (this.type==2){
            this.keyName = 'yhxy'
            title='用户协议'
        }else if (this.type==3){
            this.keyName = 'ysxy'
            title='隐私协议'
        }else if (this.type==4){
            this.keyName = 'gywm'
            title='关于我们'
        }
        //设置顶部标题
        uni.setNavigationBarTitle({
            title:title
        })
    },
    onShow() {
        this.getDisclaimerRules()
    },
    methods: {
        async getDisclaimerRules() {
            let res = await getByKeyApi(this.keyName);
            this.richText = res.data[0].configValue;
            this.richText = this.richText.replace(/<img/g, '<img style="width:100%" @click="handlePrive"' );
        },
    }
}
</script>

<style scoped lang="scss">

</style>
